<template>
  <div class="pageone">
    <h3>store的简单应用</h3>
    <p>{{res}}</p>
    <button type="submit" @click="increase">增加</button>
    <button type="submit" @click="decrease">减少</button>
  </div>
</template>

<script>
export default {
  name: 'PageOne',
  data () {
    return {
      num: 2
    }
  },
  computed: {
    res () {
      return this.$store.getters.getResult
    }
  },
  methods: {
    increase () {
      this.$store.dispatch('increase', this.num)
    },
    decrease () {
      this.$store.dispatch('decrease', this.num)
    }
  }
}
</script>
